
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "billing");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style >
	#outStockInfoCopy{display:none}
	.thumbnail{margin: 0px}
	#logo{margin: 0px;padding: 0px;}
	#pic{padding: 0px;height:60px;width:60px;}
	td input{margin-top:-1px;margin-bottom:-1px;height:21px; width:98%;border:none;color:red}
	
	body{
		font-size:9px ;
		font-family:黑体,微软雅黑;
		 
		overflow:hidden; 
	}
	.panel-body{
		overflow:auto;
	}
	.table{
		border:black 1px solid !important;
	}
	.table tr th{
		border:black 1px solid !important;
		text-align: center;
		padding:0px 2px !important;
	}
	.table tr td{	
		border:black 1px solid !important;
		padding:0px 2px !important;
		text-align: center;
	}
	.paging{
		page-break-before:always;
	}
</style>
<script type="text/javascript">
function print(){
	top.openModal("/billing/billing/billingPrint?key="+$("#billingId").val()+"&describe="+$("#describe").val(),"print_form","打印详情",1200,550);
}

function saveData(lBtn){
	if (!$("form:first").valid()){
		return;
	}
	lBtn.start();
	$("form:first").submit();
}
	

	
</script>
<ul class="nav nav-tabs nav-tabs-component " style="margin-bottom: 0px;">
	<li class="active"><a href="#billingPrint-tab" data-toggle="tab" >打印</a></li>
	<li><a href="#electricalPrint-tab" data-toggle="tab" >致悦打印</a></li>
</ul>
<div class="tab-content">
	<div class="tab-pane active" id="billingPrint-tab">
		
		<input type="hidden" id="billingId" name="billingId" value="${billing.billingId }"/>
		<t:panel cssClass="panel-flat form-detailed border-top-primary border-top-xlg minHight" customBody="true" customHead="true">
	 <t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
	 	<t:button icon="icon-floppy-disk" onclick="saveData()" laddaType="progress" cssClass="btn-info" csize="sm">保存</t:button>
		<t:button icon="icon-floppy-disk" onclick="print()" laddaType="progress" cssClass="btn-info" csize="sm">打印</t:button>
	</t:panelFoot>
	<div class="detailed-navbar-content panel-body">
		<t:form id="billingPrint" modelAttribute="billingPrint" action="/billing/billingPrint/save" method="post" cssClass="form-horizontal">
			 <input type="hidden" id="billingId" name="billingId" value="${billing.billingId }"/>
			 <div class="hide">
				 <t:hidden path="printId"/>
 				 <t:hidden path="deleteMark"/>	
 				 <t:hidden path="createUserName"/>
		 		 <t:hidden path="createUserId"/>
		 		 <t:hidden path="createDate"/>
		 		 <t:hidden path="shopId"/>
		 		 
		 		 <input type="hidden" id="printType" name="printType" value="pioneer"/>
		 		 
			</div>
			<div id="printContent" >
				<div class="text-center"><h3>${shop.shopName}销售单</h3></div>
					<table style="width:100%" border="0">
				   <div class="row">
				    	<div class="col-md-4 col-sm-4">客户：${billing.customer.customerName}</div>
				    	<div class="col-md-4 col-sm-4">开单日期：<fmt:formatDate value="${billing.createDate}" type="date" dateStyle="default" pattern="yyyy-MM-dd"/></div>
				    	<div class="col-md-4 col-sm-4">订单号：${billing.billingNo}</div>
				    </div>
				    <div class="row">
				    	<div class="col-md-4 col-sm-4">收货地址：${billing.address}</div>
				    	<div class="col-md-4 col-sm-4">联系电话：${billing.customer.customerTel}</div>
				    	<div class="col-md-4 col-sm-4">欠款：${billing.unpaidAmount}</div>
				    </div>
				   <tr>
				   	  
				   	  
				   </tr>   	    
				</table>
				<table class="table " style="margin-top:10px;">
					<tr>
						<th style="width:50px">序号</th>
			           	<th style="width:100px">条形码</th>
			           	<th style="width:100px">商品名称</th>
			           	
			           	<th style="width:100px">规格1</th>
			           	<th style="width:100px">规格2</th>
			           	<th style="width:100px">单位</th>
			           	<th style="width:100px">数量</th>
			           	<th style="width:100px">单价</th>
			           	<th style="width:100px">小计</th>
					</tr>
					<c:set var="nullAll"  value="0"/>
					<c:set var="realPriceAll"  value="0"/>
					<c:set var="sequence"  value="0"/>
					<c:forEach var="outStockShow" items="${billing.outStock.outStockShows}">
						<c:forEach var="outStockCollocation" items="${outStockShow.outStockCollocations}" >
							<c:set var="nullAll"  value="${nullAll +outStockCollocation.collocationNum}"/>
							<c:set var="realPriceAll"  value="${realPriceAll +outStockCollocation.realPrice*outStockCollocation.collocationNum}"/>
							<tr id="outStockCollocation_${sequence}">
			
								<td>${sequence +1}</td>				
				            	<td>${outStockShow.cargo.shapeCode}</td>
				            	<td>${outStockShow.cargo.cargoName}</td>
				            	<td>${outStockCollocation.collocation.propertyNameOne}</td>
				            	<td>${outStockCollocation.collocation.propertyNameTwo}</td>
								<td>${outStockShow.cargo.unit}</td>
								<td>${outStockCollocation.collocationNum}</td>
								<td>${outStockCollocation.realPrice}</td>
								<td>${outStockCollocation.realPrice*outStockCollocation.collocationNum}</td>
							</tr>
							<c:set var="sequence"  value="${sequence +1}"/>
						</c:forEach>
					</c:forEach>
					<tr>
						<td colspan="2">合计:</td>
						<td colspan="4">${tfn:toChinaMoney(realPriceAll)}</td>
						<th >${nullAll}</th>
			           	<th ></th>
			           	<th >${realPriceAll}</th>
					</tr>
					</table>
					<t:formgroup>
					</t:formgroup>
					<t:formgroup>
		            	<t:label path="actingBrand" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="actingBrand" colClass="col-sm-11 col-xs-11" />
		            </t:formgroup>
		            <t:formgroup>
		            	<t:label path="contactWay" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="contactWay" colClass="col-sm-11 col-xs-11" />
		               
		            </t:formgroup>
		            <t:formgroup>
		            	<t:label path="storekeeper" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="storekeeper" colClass="col-sm-3 col-xs-3" />
		                <t:label path="salesman" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="salesman" colClass="col-sm-3 col-xs-3" />
		                <t:label path="documentMaker" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="documentMaker" colClass="col-sm-3 col-xs-3" />
		            </t:formgroup>
		            <t:formgroup>
		            	<t:label path="checker" cssClass="col-sm-1 col-xs-1" />
		                <t:input path="checker" colClass="col-sm-3 col-xs-3" />
		             
		            </t:formgroup>
			</div>
		</t:form>
	</div>

</t:panel>
	</div>
	<div class="tab-pane" id="electricalPrint-tab">
		<iframe id="electricalPrintIframe" name="electricalPrintIframe" scrolling="auto" frameborder="0"
				scrolling="yes" width="100%" height="100%"  data-src="<c:url value='/billing/billingPrint/electricalPreview?key=${t_key }'/>">
        </iframe>
	</div>
</div>

<script type="text/javascript">
$(function(){
	iframeLazyOpen();
	tabpaneResize();

})

function iframeLazyOpen(){
	$(".nav.nav-tabs.nav-tabs-component li a").click(function(){
		var iframeTab = $(this).attr("href");
		var iframeId = iframeTab.substring(0,iframeTab.indexOf("-")) + "Iframe";
		$(iframeId).attr("src",$(iframeId).attr("data-src"));
	});
}

function tabpaneResize(){
	$(".tab-pane").height($(window).height() - 42);
	$(".panel-body").height($(window).height() - 116);
	$(window).bind("resize",function(){$(".tab-pane").height($(window).height() - 42)});
	
}
</script>

<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formtags.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>

<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>


